﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CarHelpDesk.Web.Models.Repositories
{
    public interface IAnswersRepository
    {
        /// <summary>
        /// Retrieves all answers given to specified Question
        /// </summary>
        /// <param name="questionID">valid question identificator</param>
        /// <returns>IQueryable of Answers</returns>
        IQueryable<Answer> getAnswersByQuestionID(int questionID);

        /// <summary>
        /// Saves answer to the database
        /// </summary>
        /// <param name="answer">The answer.</param>
        void Create(Answer answer);


        /// <summary>
        /// Retrieves the answer by ID.
        /// </summary>
        /// <param name="answerID">The valid answer ID.</param>
        /// <returns></returns>
        Answer getAnswerByID(int answerID);

        /// <summary>
        /// Delete all answers associated with an existing question.
        /// </summary>
        /// <param name="questionID">question ID</param>
        void DeleteAnswersByQuestionID(int questionID);

        /// <summary>
        /// Updates the specified answer
        /// </summary>
        /// <param name="answerToUpdated">The answer to updated.</param>
        void Update(Answer answer);

        /// <summary>
        /// Marks answer as accepted.
        /// </summary>
        /// <param name="answer">The answer.</param>
        void MarkAnswerAsCorrect(Answer answer);


        /// <summary>
        /// Gets AnswerVote for user.
        /// </summary>
        /// <param name="answer">The answer.</param>
        /// <param name="userID">The user ID.</param>
        /// <returns>The AnswerVote or null if there is none</returns>
        AnswerVote GetAnswerVote(Answer answer, Guid userID);


        /// <summary>
        /// Creates an AnswerVote.
        /// </summary>
        /// <param name="vote">The vote.</param>
        void CreateAnswerVote(AnswerVote vote);

        /// <summary>
        /// Delete all answer votes associated with an existing answer.
        /// </summary>
        /// <param name="answerID"></param>
        void DeleteAnswerVoteByAnswerID(int answerID);
        
    }
}
